home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / a86v311a.arc / 02DEMO.DOC < prev    next >
Text File  |  1987-09-25  |  6KB  |  119 lines

  1. CHAPTER 2   A86 DEMONSTRATION                             2-1
  2.  
  3.  
  4. Demonstration of A86 and Associated Tools
  5.  
  6. To give you a feeling for the operation of A86, I have provided
  7. some source files for you to assemble.  You should print out this
  8. 02DEMO.DOC file, make sure your current directory is the one that
  9. contains this assembler package, and perform the following
  10. operations to see the assembler package in action:
  11.  
  12.  
  13. Assembling a Very Short Program: PAGE.COM
  14.  
  15. First, let's assemble a very short program; a program that sends
  16. an ASCII form-feed (hex 0C) to your line-printer.  The source for
  17. this program is PAGE.8; type the command TYPE PAGE.8 to see how
  18. simple this program is: note the lack of red-tape directives
  19. (NAME, ASSUME, END, PUBLIC, etc.) required by other assemblers.
  20. Now type the command A86 PAGE.8 to assemble the file.  If you are
  21. working on a hard disk, make sure you don't blink your eyes after
  22. typing the command; you'll miss the assembly, because A86 is
  23. FAST, FAST, FAST.
  24.  
  25. You now have a file PAGE.COM, which is an executable program.  If
  26. you now type the command PAGE with your printer turned on, and if
  27. your printer recognizes the form-feed character, then it should
  28. advance to the next page.  You have just created a useful tool.
  29. By altering the DB line in the source-code that contains the
  30. form-feed, you can create tools to output other control-sequences
  31. to your printer.
  32.  
  33.  
  34. Demonstration of Error-Reporting
  35.  
  36. Now type the command ERDEMO, invoking the batch file ERDEMO.BAT.
  37. This will invoke an assembly of a source file PAGE.BAD (copied
  38. from PAGE.BL so you can run this demo again), into which I have
  39. deliberately placed an erroneous statement, XCHG BL,AX.  Note
  40. that A86 tells you that it has inserted error messages into
  41. PAGE.BAD, and saved the original source in PAGE.OLD.
  42.  
  43. Now use your favorite text editor to edit PAGE.BAD.  You can use
  44. your editor's string-search function to find a tilde-symbol,
  45. which brackets all A86 error messages.  Without altering the
  46. messages, change the BL to BX, and exit your editor.  Now type
  47. the command A86 PAGE.BAD to reassemble the file.  You should get
  48. a successful assembly.  Now type the command TYPE PAGE.BAD, and
  49. note that A86 has removed the error messages for you.  Wasn't
  50. that easy?
  51.                                                           2-2
  52. Assembling a Longer Program with Library Files: REV.COM
  53.  
  54. Let's see A86 assemble a program with four source files. Type the
  55. command A86 REV.8 to the console.  A86 will assemble the REV.8
  56. file you specified, see that there are undefined symbols in the
  57. program, then assemble the files LINES.8, MSDOS.8, and USAGE.8,
  58. listed in the library file A86.LIB, which I created using the
  59. tool A86LIB available only to registered users.
  60.  
  61. REV is a tool that exists in the Unix operating system.  It is a
  62. "filter"; that is, it reads from standard input, transforms the
  63. input, and outputs the transformed data to standard output.  The
  64. transformation that REV performs is to reverse all lines, so that
  65. they come out backwards.
  66.  
  67. The usefulness of REV is in conjunction with other tools. In
  68. particular, suppose you have a list of words that you wanted
  69. sorted according to their last letters, not their first.  You run
  70. the list through REV, to get the words spelled backwards.  Then
  71. you run that output through SORT, to sort them that way.
  72. Finally, you run the output of SORT through REV again, to get the
  73. words spelled forwards again, but still sorted according to their
  74. backwards-spellings.
  75.  
  76. The normal usage of REV is, therefore, in conjunction with
  77. redirection of standard input and output; e.g. REV <infile
  78. >outfile.  If you want to just see if REV works, type REV, the
  79. enter key, your first name, the enter key, your last name, the
  80. enter key, the F6 key, and the enter key.  You'll get your first
  81. and last name spelled backwards.
  82.  
  83.  
  84. Using XREF on a medium-sized program: TCOLS.COM
  85.  
  86. Type the command MTCOLS to execute the batch file MTCOLS.BAT.
  87. Observe that the file assembles the file TCOLS.8 into the program
  88. TCOLS.COM.  Then the batch-file runs the XREF program, to produce
  89. a cross-reference listing TCOLS.XRF of the program.
  90.  
  91. Type the command TCOLS.  The TCOLS program you just assembled
  92. will execute, notice that you have given it no parameters, and
  93. thus give you a self-documenting message.  Note that towards the
  94. end of the message is an example showing how TCOLS can be used to
  95. print XREF listings.  You can do so now by turning your printer
  96. on and typing an appropriate command; e.g., TCOLS <TCOLS.XRF >PRN
  97. 4 6 80 66 for 4 columns, skip 6 lines between pages, which are 80
  98. columns by 66 lines.
  99.                                                           2-3
  100. Using EXMAC
  101.  
  102. Type the command MEXP, invoking the batch file MEXP.BAT, which
  103. executes the command EXMAC TCOLS <TCOLS.8 >TCOLS.EXP to create a
  104. version of TCOLS with macros expanded.  Look at the file
  105. TCOLS.EXP, and note that the DEFAULT macro defined there has had
  106. all of its calls expanded.  Type the command A86 TCOLS.EXP and
  107. note that it assembles into TCOLS.COM just as the original file
  108. does.
  109.  
  110. Type the command EXMAC TCOLS to enter interactive-mode.  The
  111. program pauses, waiting for you to type in lines.  Type a garbage
  112. line, e.g. "abc", and see the line echoed back to you.  Now type
  113. the macro-call: DEFAULT FOO,7 and see the macro expanded
  114. interactively.  Type Control-Z followed by the enter key to exit
  115. the EXMAC program.  (On most IBM-compatible computers you can
  116. type F6 to get a control-Z.)
  117.  
  118.  
  119.